<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增资产维修')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-repairs-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">维修编号：</label>
                <div class="col-sm-8">
                    <input name="repairsNo" readonly="readonly" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">维修日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="repairsTime" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group" style="display: none;">
                <label class="col-sm-3 control-label is-required">报修人编号：</label>
                <div class="col-sm-8">
                    <input name="userId" class="form-control" type="text" th:value="${userid}" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required" >报修人：</label>
                <div class="col-sm-8">
                    <input name="userName" class="form-control" type="text" th:value="${username}" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required" >报修手机：</label>
                <div class="col-sm-8">
                    <input name="userMobile" class="form-control" type="text" th:value="${phone}" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required" >报修人位置：</label>
                <div class="col-sm-8">
                    <input name="userSeat" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">设备编号：</label>
                <div class="col-sm-8">
                    <input name="assetsId" class="form-control" type="text" th:value="${assetsid}" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">设备名称：</label>
                <div class="col-sm-8">
                    <input name="assetsName" class="form-control" type="text" th:value="${assetsName}">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">SN号：</label>
                <div class="col-sm-8">
                    <input name="assetsSn" class="form-control" type="text" th:value="${assetsSn}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">维修说明：</label>
                <div class="col-sm-8">
                    <textarea name="repairsDesc" class="form-control"></textarea>
                </div>
            </div>
            <!--<div class="form-group" style="display: none;">-->
                <!--<label class="col-sm-3 control-label">照片附件：</label>-->
                <!--<div class="col-sm-8">-->
                    <!--<textarea name="repairsPic" class="form-control"></textarea>-->
                <!--</div>-->
            <!--</div>-->
            <div class="form-group">
                <label class="col-sm-3 control-label">维修状态：</label>
                <div class="col-sm-8">
                    <select name="receiveType" class="form-control m-b" th:with="type=${@dict.getType('receive_type')}">
                        <option value="1">维修</option>
                    </select>
                </div>
            </div>
            <!--<div class="form-group">    -->
                <!--<label class="col-sm-3 control-label">角色编号：</label>-->
                <!--<div class="col-sm-8">-->
                    <!--<input name="roleId" class="form-control" type="text" th:value="${roleId}">-->
                <!--</div>-->
            <!--</div>-->
            <div class="form-group" style="display: none;">
                <label class="col-sm-3 control-label">供应商：</label>
                <div class="col-sm-8">
                    <input name="factoryId" readonly="readonly" class="form-control" type="text" th:value="${factoryId}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">供应商名称：</label>
                <div class="col-sm-8">
                    <input name="factoryName" readonly="readonly" class="form-control" type="text" th:value="${factoryName}">
                </div>
            </div>
            <!--<div class="form-group" style="display: none;">-->
                <!--<label class="col-sm-3 control-label">维修人编号：</label>-->
                <!--<div class="col-sm-8">-->
                    <!--<input name="repairsUserId" readonly="readonly" class="form-control" type="text" th:value="${repairsUserId}">-->
                <!--</div>-->
            <!--</div>-->
            <!--<div class="form-group" style="display: none;">-->
                <!--<label class="col-sm-3 control-label">维修人名称：</label>-->
                <!--<div class="col-sm-8">-->
                    <!--<input name="repairsUserName" readonly="readonly" class="form-control" type="text" th:value="${repairsUserName}">-->
                <!--</div>-->
            <!--</div>-->
            <!--<div class="form-group" style="display: none;">-->
                <!--<label class="col-sm-3 control-label">结单答复：</label>-->
                <!--<div class="col-sm-8">-->
                    <!--<textarea name="repairsAnswer" class="form-control"></textarea>-->
                <!--</div>-->
            <!--</div>-->
            <!--<div class="form-group" style="display: none;">-->
                <!--<label class="col-sm-3 control-label">结单时间：</label>-->
                <!--<div class="col-sm-8">-->
                    <!--<div class="input-group date">-->
                        <!--<input name="repairsAnswerTime" class="form-control" placeholder="yyyy-MM-dd" type="text">-->
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                    <!--</div>-->
                <!--</div>-->
            <!--</div>-->
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        $(document).ready(function(){
            var currtime = new Date().Format("yyyy-MM-dd");
            $("*[name='repairsTime']").val(currtime);
            $("*[name='repairsAnswerTime']").val(currtime);

            var repairsNo = new Date().Format("yyyyMMddHHmmss");
            $("*[name='repairsNo']").val('W'+repairsNo);
        });

        var prefix = ctx + "assets/repairs"
        $("#form-repairs-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-repairs-add').serialize());
            }
        }

        $("input[name='repairsTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='repairsAnswerTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });



        Date.prototype.Format = function (fmt) {
            var o = {
                "M+": this.getMonth() + 1, //月份
                "d+": this.getDate(), //日
                "H+": this.getHours(), //小时
                "m+": this.getMinutes(), //分
                "s+": this.getSeconds(), //秒
                "q+": Math.floor((this.getMonth() + 3) / 3), //季度
                "S": this.getMilliseconds() //毫秒
            };
            if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
            for (var k in o)
                if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
            return fmt;
        }
    </script>
</body>
</html>